<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function fn(a){
            flag=1;
            for(var i=2;i<a;i++)
            {
                if(a%i===0)
                flag=0;
            }
            return flag;
        }
        //fn(2)
        console.log("是否是质数");
            console.log(Boolean(fn(4)));
    </script>
</body>
</html>